var express = require('express');
var cookieparser =require('cookie-parser');
var router = express.Router();
router.use(cookieparser());
/* GET home page. */
router.get('/', function(req, res, next) {
  res.send('首页');
  // res.render('index', { title: 'Express' });
});
router.get('/set',(req,res=>{
  res.cookie('userName','Harrison',{
    httpOnly:true,
    maxAge:10000
  });
  res.send('cookie设置成功!');
}));
router.get('/get',(req,res)=>{
  res.send('获取cookie为：'+req.cookies.userName);
});
module.exports = router;
